<?php

/**
 * Commerces form base class.
 *
 * @package    virtualdelivery
 * @subpackage form
 * @author     Your name here
 */
class BaseCommercesForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'com_id'              => new sfWidgetFormInputHidden(),
      'com_corporate_name'  => new sfWidgetFormInput(),
      'com_trade_name'      => new sfWidgetFormInput(),
      'com_cuit'            => new sfWidgetFormInput(),
      'com_sta_id'          => new sfWidgetFormPropelChoice(array('model' => 'GeoStates', 'add_empty' => false)),
      'com_cty_id'          => new sfWidgetFormPropelChoice(array('model' => 'GeoCities', 'add_empty' => false)),
      'com_phone'           => new sfWidgetFormInput(),
      'com_alternate_phone' => new sfWidgetFormInput(),
      'com_fax'             => new sfWidgetFormInput(),
      'com_web_site'        => new sfWidgetFormInput(),
      'com_email'           => new sfWidgetFormInput(),
      'com_picture'         => new sfWidgetFormInput(),
      'com_coverage_area'   => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'com_id'              => new sfValidatorPropelChoice(array('model' => 'Commerces', 'column' => 'com_id', 'required' => false)),
      'com_corporate_name'  => new sfValidatorString(array('max_length' => 80)),
      'com_trade_name'      => new sfValidatorString(array('max_length' => 80)),
      'com_cuit'            => new sfValidatorString(array('max_length' => 17)),
      'com_sta_id'          => new sfValidatorPropelChoice(array('model' => 'GeoStates', 'column' => 'sta_id')),
      'com_cty_id'          => new sfValidatorPropelChoice(array('model' => 'GeoCities', 'column' => 'cty_id')),
      'com_phone'           => new sfValidatorString(array('max_length' => 16)),
      'com_alternate_phone' => new sfValidatorString(array('max_length' => 16, 'required' => false)),
      'com_fax'             => new sfValidatorString(array('max_length' => 16, 'required' => false)),
      'com_web_site'        => new sfValidatorString(array('max_length' => 100)),
      'com_email'           => new sfValidatorString(array('max_length' => 40)),
      'com_picture'         => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'com_coverage_area'   => new sfValidatorString(array('max_length' => 20, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('commerces[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Commerces';
  }


}
